#!/bin/bash

echo "Compiling redis++ examples..."

# Compile the RedisWrapper class
g++ -std=c++17 -fPIC -c RedisWrapper.cpp -o RedisWrapper.o -lredis++ -lhiredis -pthread

# Compile the wrapper example
g++ -std=c++17 -o wrapper_example wrapper_example.cpp RedisWrapper.o -lredis++ -lhiredis -pthread

# Compile the simple redis++ example
g++ -std=c++17 -o redis_example redis++.cpp -lredis++ -lhiredis -pthread

if [ $? -eq 0 ]; then
    echo "Compilation successful!"
    echo "Run examples with:"
    echo "  ./redis_example"
    echo "  ./wrapper_example"
else
    echo "Compilation failed!"
fi